<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.meichaoit.entity.Account"%>
<%@page import="com.meichaoit.util.Const"%>
<%@page import="com.meichaoit.dao.AccountDao"%>

<%
	
	request.setCharacterEncoding("UTF-8");

	String name=request.getParameter("username");
	String pwd=request.getParameter("password");
	
	Account account = new Account();
	account.setUsername(name);
	account.setPassword(pwd);
	account.setMoney(0f);
	account.setIsenable(Const.USER_ENABLE);
	
	AccountDao dao = new AccountDao();
	int rows=dao.save(account);
	if(rows>0){
		response.sendRedirect("login.jsp?code=01");
	}else{
		response.sendRedirect("reg.jsp?code=02");
	}
%>